package com.kele.single;

/**
 * @author kele
 * @date 2021/10/13 15:48
 * @description
 * 饿汉式单例模式
 */
public class Hungry {

    private Hungry(){

    }

    private static final  Hungry HUNGRY=new Hungry();

    public static Hungry getInstance(){
        return HUNGRY;
    }

    public static void main(String[] args) {
        Hungry instance = Hungry.getInstance();
        Hungry instance1 = Hungry.getInstance();
        System.out.println(instance==instance1);
    }
}
